package com.example.schoolexam2.mapper;

import com.example.schoolexam2.dto.StudentDto;
import com.example.schoolexam2.entity.Student;
import com.example.schoolexam2.entity.StudentTemporaryBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {
    //导入excel表数据
    @Insert("insert into student(student_Id,id_Number,student_Name,sex,grade,year) values(#{studentId},#{id_Number},#{name},#{sex},#{grade},#{year})")
    int studentIncreases(StudentTemporaryBean studentTemporaryBean);
    @Insert("insert into student(student_Id,id_Number,student_Name,sex,grade,Phone_Number,photo,password,class_id,year) values(#{studentId},#{idNumber},#{studentName},#{sex},#{grade},#{photoNumber},#{photo},#{password},#{classId},#{year})")
    int studentIncrease(StudentDto student);
    //虚假删除学生
    @Update("UPDATE student SET isuser = #{isUser}  WHERE student_id= #{studentId}")
    int studentDelete(String studentId, int isUser);
    //真实删除学生
    @Delete("DELETE FROM student WHERE student_id=#{studentId}")
    int studentDeleteTrue(String studentId);
    @Update("UPDATE student SET id_Number = #{idNumber},student_Name = #{studentName},sex = #{sex},grade = #{grade},Phone_Number = #{photoNumber},photo = #{photo},password = #{password},class_id = #{classId},year = #{year} WHERE student_Id = #{studentId}")
    int studentUpdate(Student student);
    @Select(" SELECT * FROM student WHERE student_Id =#{studentId}")
    Student studentPersonal(String studentId);
    @Select(" SELECT * FROM student WHERE student_Name LIKE '%' #{fuzzy} '%' ")
    List<Student> studentFuzzy(String fuzzy);
    @Select(" SELECT * FROM student WHERE class_id = #{classId}")
    List<Student> studentAll(String classId);
}
